home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93b.txt / 000104_icon-group-sender _Fri May 14 20:08:19 1993.msg < prev    next >
Internet Message Format  |  1993-06-16  |  4KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 18 May 1993 18:05:21 MST
  2. Received: by owl.cs.arizona.edu; Tue, 18 May 1993 18:05:20 MST
  3. Date: 14 May 93 20:08:19 GMT
  4. From: dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!ux1.cso.uiuc.edu!uwm.edu!csd4.csd.uwm.edu!corre@ucbvax.Berkeley.EDU  (Alan D Corre)
  5. Organization: Computing Services Division, University of Wisconsin - Milwaukee
  6. Subject: Grade Program with LaTeX
  7. Message-Id: <1t0u7jINNivi@uwm.edu>
  8. Sender: icon-group-request@cs.arizona.edu
  9. To: icon-group@cs.arizona.edu
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13. Since I am retiring this month, I am clearing away things I no longer need,
  14. both tangible and electronic.  I thought some of you might be able to use
  15. the ideas in the following little grade calculation program, which has as
  16. its output a LaTeX input file.  This is then submitted to the LaTeX processor
  17. which produces a nice looking table.  It would be possible to enter the
  18. information from a file, to sort the resulting table by number and add other
  19. bells and whistles. (I use just the last four digits of the social security
  20. number.)  Probably your fancy word processor can do an equally good or better
  21. job.  But it might spark some ideas. As King Solomon said: Iron sharpens
  22. iron, and a man sharpens the countenance of his friend. I guess that's what
  23. the net is all about.
  24. ***
  25.  
  26. procedure main()
  27.   printinfo(getinfo())
  28. end
  29.  
  30. procedure getinfo()
  31. local infolist, socsec
  32.   infolist := []
  33.   writes("Number of course? ")
  34.   put(infolist,read())
  35.   writes("Section of course? ")
  36.   put(infolist,read())
  37.   writes("Date of course? ")
  38.   put(infolist,read())
  39.   writes("Enter Social Security Number. Period to finish. ")
  40.   while (socsec := read()) ~== "." do {
  41.     put(infolist,socsec)
  42.     writes("First Exam? ")
  43. #enter a question mark if grade is unknown
  44.     put(infolist,read())
  45.     writes("Second Exam? ")
  46.     put(infolist,read())
  47.     writes("Third Exam? ")
  48.     put(infolist,read())
  49.     writes("Enter Social Security Number. Period to finish. ")}
  50. return infolist
  51. end
  52.  
  53. procedure printinfo(i)
  54. local outfile, n,total,flag
  55.   n := 3
  56.   outfile := open(i[1] || i[2] || i[3] || ".tex","w")
  57.   write(outfile,"\\documentstyle{article}")
  58.   write(outfile,"\\begin{document}")
  59.   write(outfile,"\\begin{center}")
  60.   write(outfile,"Course Number ",i[1]," Section ",i[2]," \\\\[.25in]")
  61.   write(outfile,"Semester ",i[3]," \\\\[.25in]")
  62.   write(outfile,"\\begin{tabular}{|c|c|c|c|c|c|} \\hline")
  63.   write(outfile,"S.S. & I & II & III & Total & Grade \\\\ \\hline")
  64.     while n < *i do {
  65.       total := 0
  66.       flag := &null
  67.       writes(outfile,i[n +:= 1]," & ")
  68.       every 1 to 3 do {
  69.         writes(outfile,i[n +:= 1]," & ")
  70.         if i[n] == "?" then flag := 1
  71.         if /flag then total +:= i[n]}
  72.       if /flag then writes(outfile," ",total)
  73.       writes(outfile," & ")
  74.       if /flag then write (outfile,grade(total), " \\\\ \\hline") else
  75.         write(outfile,"I \\\\ \\hline")}
  76.   write(outfile,"\\end{tabular}")
  77.   write(outfile,"\\end{center}")
  78.   write(outfile,"\\end{document}")
  79. return
  80. end
  81.  
  82. procedure grade(n)
  83. local g
  84.   n := integer(n + 0.5)
  85.   if n >= 63 then g := "A" else
  86.   if n >= 48 then g := "B" else
  87.   if n >= 33 then g := "C" else  
  88.   if n >= 18 then g := "D" else
  89.   g := "F"
  90. return g
  91. end
  92. -- 
  93. Alan D. Corre
  94. Department of Hebrew Studies
  95. University of Wisconsin-Milwaukee                     (414) 229-4245
  96. PO Box 413, Milwaukee, WI 53201               corre@csd4.csd.uwm.edu
  97.